def prost(a):
    k=0
    for i in range(1,a+1):
        if a%i==0:
            k+=1
    if k!=2:
        return True
    else:
        return False
s = input()
s = s.split()
s1=0
for i in range(len(s)):
    if s[i]=="zero":
        s1+=0
        s1*=10
    if s[i]=="one":
        s1+=1
        s1*=10
    if s[i]=="two":
        s1+=2
        s1*=10
    if s[i]=="three":
        s1+=3
        s1*=10
    if s[i]=="four":
        s1+=4
        s1*=10
    if s[i]=="five":
        s1+=5
        s1*=10
    if s[i]=="six":
        s1+=6
        s1*=10
    if s[i]=="seven":
        s1+=7
        s1*=10
    if s[i]=="eight":
        s1+=8
        s1*=10
    if s[i]=="nine":
        s1+=9
        s1*=10
s1//=10
a = s1
b = s1
while (prost(a) and prost(b)):
    a+=1
    b-=1
if s1<100 or s1>999:
    print("Wrong input")
else:
    if not(prost(a)) and not(prost(b)) and a-s1==s1-b:
        print(b)
    elif not(prost(a)) and prost(b):
        print(a)
    elif not(prost(b)) and prost(a):
        print(b)
    else:
        print(b)
